<template>
  <div>
    <div class="modal">
      <div class="modal-bg" @click="BuilClose"></div>
      <div class="pub-w">
        <div class="rele-title">添加楼栋<span @click="BuilClose">X</span></div>
        <div class="pub-list">
          <div class="pub-li">
            <div class="pub-title">添加楼栋</div>
            <div class="pub-input"><input type="" name="" v-model="buildingtitle"></div>
          </div>
          <div class="pub-li">
            <div class="pub-title">排序值</div>
            <div class="pub-input"><input type="" name="" v-model="Dsort"></div>
          </div>
          <div class="pub-li">
            <button v-show="tjdShow" @click="tianjiaD">添加</button>
            <button v-show="xgdShow" @click="xiugaiD">修改</button>
            <button @click="BuilClose">取消</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script type="text/babel">
  export default {
    props: {
      BuilClose: {
        type: Function
      },
      loudongID:{
        type:Number
      }
    },
    data() {
      return {
        partvalue: '',
        fenquArr:[],
        Dsort:'',
        buildingtitle:'',
        tjdShow:true,
        xgdShow:false,
      }
    },
    methods:{
      TJgoD() {
        let that = this;
        that.tjdShow = true;
        that.xgdShow = false;
      },
      XGgoD() {
        let that = this;
        that.tjdShow = false;
        that.xgdShow = true;
      },
      tianjiaD(){
        this.$http.post('/newapi/Premisesbuilding/add',{
          premisespartition_id:this.loudongIDs,
          buildingtitle:this.buildingtitle,
          sort:this.Dsort
        }).then(res=>{
          if(res.data.status === 200){
            this.BuilClose();
            console.log(res.data.message)
          }

        }).catch(err=>{
          console.log(err)
        })
      },
      xiugaiD(){

      }
    },
    created() {
    },
  computed:{
    loudongIDs(){
      return this.loudongID
    }
  }
  }
</script>
<style scoped>
  .pub-li button {
    width: 100px;
    font-size: 1.1em;
    background: #ed7d31;
    color: #ffffff;
    border: none;
    float: left;
    border-radius: 5px;
    line-height: 35px;
  }
  .pub-li button:last-child {
    float: right;
    background: none;
    border: 1px solid #ed7d31;
    color: #ed7d31
  }
  .pub-list {
    width: 100%;
    float: left;
    text-align: center;
  }
  .pub-input {
    width: 70%;
    float: left;
  }
  .pub-input input {
    width: 100%;
    line-height: 27px;
    height: 27px;
    float: left;
    box-sizing: border-box;
    border-radius: 5px;
    border: 1px solid #d3d3d3;
  }
  .pub-li {
    margin-top: 20px;
    width: 80%;
    display: inline-block;
  }
  .pub-title {
    width: 30%;
    line-height: 27px;
    text-align: center;
    font-size: 1.1em;
    float: left;
  }
  .pub-w {
    width: 20%;
    left: 40%;
    height: 210px;
    top: 50%;
    overflow: hidden;
    margin-top: -105px;
    background: #ffffff;
    border-radius: 5px;
    position: absolute;
    z-index: 10;
  }
</style>
